package edu.sctu.practice.class02.lvchang.textInnerClass;

/**
 * Created by Administrator on 2015/10/21.
 */
public class InnerClassDemo {

    private String name = "Justin";//外部类的私有属性name

    int age = 20;//外部类的成员属性

    //成员内部类Inner
    public class Inner {
        String name = "Jack";

        //内部类中的方法
        public void show() {
            System.out.println("out:" + InnerClassDemo.this.name);
            System.out.println("in:" + name);
            System.out.println("out:" + age);
        }
    }

    //测试成员内部类
    public static void main(String[] args) {
        //创建外部类的对象
        InnerClassDemo out = new InnerClassDemo();
        //创建内部类的对象
        Inner in = out.new Inner();
        //调用内部类对象的show方法
        in.show();
    }
}